<template>
  <div>
    <van-sticky>
      <van-nav-bar
        title="资质修改"
        left-text="返回"
        left-arrow
        fixed
        @click-left="onClickLeft"
      ></van-nav-bar>
    </van-sticky>
    <div class="main">
      <van-cell-group inset>
        <van-field
          v-model="qualifications"
          rows="2"
          autosize
          label="资质"
          type="textarea"
          maxlength="50"
          placeholder="请输入资质"
          show-word-limit
        />
      </van-cell-group>
      <div class="submit">
        <van-button size="small" type="primary" @click="submit"
          >提交</van-button
        >
      </div>
    </div>
  </div>
</template>

<script lang="ts">
import { defineComponent, ref } from 'vue'
import { updateEInquiryItem } from './api'
import { useRoute } from 'vue-router'
import { Notify } from 'vant'
export default defineComponent({
  setup() {
    const route = useRoute()
    let qualifications = ref('')
    const submit = () => {
      let params = {
        id: route.query.id,
        qualifications: qualifications.value,
      }
      updateEInquiryItem(params).then((res) => {
        Notify({ type: 'success', message: '修改成功' })
        history.back()
      })
    }
    return {
      onClickLeft() {
        history.back()
      },
      submit,
      qualifications,
    }
  },
})
</script>

<style lang="less" scoped>
.main {
  padding-top: 46px;
  height: 100vh;

  .submit {
    margin-top: 20px;
    text-align: center;
  }
}
</style>
